#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std; 


int main()
{
	vector<int> a; 
	unsigned n, m, i, sum, r=0; 
	
	//freopen("p1181.in", "r", stdin); 
	cin>>n>>m; 
	a.resize(n); 
	for (i=0; i<n; i++) {
		cin>>a[i]; 
	}
	sum = 0; 
	for (i=0; i<n; i++) {
		if (sum+a[i]<=m) {
			sum += a[i]; 
		} else {
			sum = a[i]; 
			r++; 
		}
	}
	if (sum!=0) {
		r++; 
		sum = 0; 
	}
	cout<<r<<endl; 
	return 0; 
}

